import { Controller, Get, Body, Post, Param, Delete } from '@nestjs/common';
import { ApiTags, ApiBody, ApiOperation, ApiParam } from '@nestjs/swagger';
import { OrganiService } from './organi.service';
import { Organi } from './organi.entity';

@ApiTags('机构模块')
@Controller('organi')
export class OrganiController {
  constructor(private readonly organiService: OrganiService) {}

  // 创建用户数据
  @Post('')
  @ApiParam({ name: 'id', description: '用户ID' })
  @ApiOperation({
    summary: '创建企业信息',
    description: '用于创建新的企业信息',
    parameters: [],
  })
  @ApiBody({ type: Organi, required: true, description: '企业信息' })
  async create(@Param('id') id: string, @Body() body: Organi): Promise<Organi> {
    return await this.organiService.create(body);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.organiService.findOne(+id);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.organiService.remove(+id);
  }
}
